package com.xb.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xb.model.domain.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * (Users)表数据库访问层
 *
 * @author makejava
 * @since 2024-07-15 13:18:59
 */
@Mapper
public interface UsersMapper extends BaseMapper<Users> {
    /**
     * 验证规则，手机号完全匹配，用户名最后一个字匹配，因为我在脱敏的时候只保留姓名最后一个字在数据库
     * @param phone
     * @param username
     * @return
     */
    @Select("SELECT COUNT(*) FROM users WHERE phone = #{phone} AND name LIKE CONCAT('%', SUBSTRING(#{username}, -1))")
    int checkUserMatch(String phone, String username);


    void createIndexes();
    
    void dropIndexes();

}

